package xyz.lisys.groovy

// https://zhuanlan.zhihu.com/p/354484932
// https://www.cnblogs.com/freshchen/p/12221925.html

detailInfo = [:]

// 元方法
// invokeMethod()
// setProperty()
// hasProperty()
// methodMissing()
def methodMissing(String name, args) {
    detailInfo[name] = args
}

def introduce(closure) {
    closure.delegate = this
    closure()
    detailInfo.each {
        key, value -> println "My $key is $value"
    }
}

introduce {
    name "zx"
    age 18
}
